<%@ page pageEncoding="UTF-8"%>
<%@ include file="../commons/head.jsp"%>
<title>逻辑运算符("&&","||")和位运算符("&","|")</title>
<style type="text/css">
</style>
<script type="text/javascript">
$.extend($.fn.validatebox.defaults.rules, {
	//非空切只能是整数的验证
    pass: {
        validator: function (value,param) {debugger
        	if(value != "" && value != null){
        		if(!/^\+?[1-9][0-9]*$/.test(value)){
            		$.fn.validatebox.defaults.rules.pass.message= "只能输入数字";
            		return false;
            	}
        		return true;
        	}
        	return true;
        },
    },
});
	$(function(){
		$('#fm1').form({
			url:'${ctx}/cultivate/search1',
			onSubmit: function(){
				
			},
			success:function(data){debugger
				$(".oper #result1").textbox("setValue", data);
			}
		});
		$('#fm2').form({
			url:'${ctx}/cultivate/search2',
			onSubmit: function(){
	    		return $(this).form('validate');
			},
			success:function(data){debugger
				$(".oper #result2").textbox("setValue", data);
			}
		});
	});
	function saved1(){debugger
		$('#fm1').submit();
	};
	function saved2(){debugger
		$('#fm2').submit();
	};
</script>
</head>
<body>
	<div class="oper">
		<h3>逻辑运算符("&&","||")和位运算符("&","|")</h3>
		<div>
			<p>	&&	逻辑与	</p>
			<p>&nbsp;&nbsp;&nbsp;&nbsp;两个结果都为真，结果才为真，有一边为假，结果为假；</p>
			<p>	||	逻辑或	</p>
			<p>&nbsp;&nbsp;&nbsp;&nbsp;两个结果都为假，结果才为假，有一边为真，结果为真；</p>
			
			<p>	☆：</p>
			<p>		“&&” 和 “||” 都是“短路”运算符。即当一个表达式能确定整个表达式的结果时，则另一个表达式不再执行。</p>
			实例:
				<form id="fm1" method="post" class="form-horizontal" role="form">
					<select id="condition1" name="condition1" class="easyui-combobox" panelHeight="auto">
						<option value="true">true</option>
						<option value="false">false</option>
					</select>
					<select id="operational1" name="operational1" class="easyui-combobox" panelHeight="auto">
						<option value="&&">&&&nbsp;&nbsp;</option>
						<option value="||">||&nbsp;&nbsp;</option>
					</select>
					<select id="condition2" name="condition2" class="easyui-combobox" panelHeight="auto">
						<option value="true">true</option>
						<option value="false">false</option>
					</select>
				</form>
				<a id="search" href="#" class="easyui-linkbutton button" style="margin-left:15px;" iconCls="icon-search" onclick="javascript:saved1()">查询</a>
				<input class="easyui-textbox" style="width:125px" name="result1" id="result1" placeholder="查询结果" readonly="readonly"/>
		</div>
		<hr>
		<div>
			<p>	&	按位与	</p>
			<p>&nbsp;&nbsp;&nbsp;&nbsp;有0为0，无0为1；</p>
			<p>	|	按位或	</p>
			<p>&nbsp;&nbsp;&nbsp;&nbsp;有1为1，无1为0；</p>
			
			<p>	☆：</p>
			<p>		位运算符都是基于 二进制 方式进行的。</p>
			实例:
				<form id="fm2" method="post" class="form-horizontal" role="form">
					<input class="easyui-textbox" style="width:125px" name="condition3" id="condition3" validType="pass[0,100]"/>
					<select id="operational2" name="operational2" class="easyui-combobox" panelHeight="auto">
						<option value="&">&&nbsp;&nbsp;</option>
						<option value="|">|&nbsp;&nbsp;</option>
					</select>
					<input class="easyui-textbox" style="width:125px" name="condition4" id="condition4" validType="pass[0,100]"/>
				</form>
				<a id="search" href="#" class="easyui-linkbutton button" style="margin-left:15px;" iconCls="icon-search" onclick="javascript:saved2()">查询</a>
				<input class="easyui-textbox" style="width:125px" name="result2" id="result2" placeholder="查询结果" readonly="readonly"/>
		</div>
	</div>
</body>
</html>